import { defineStore } from "pinia";
import {
  getGoodsAddressSale,
  getGoodsCategoryCount,
  getGoodsCategoryFavor,
  getGoodsCategorySale
} from '@/services/echart'
const useEchartsStore = defineStore('echarts', {
  state: () => ({
    addressWithSale: [],
    categoryWithCount: [],
    categoryWithFavor: [],
    categoryWithSale:[]
  }),
  actions: {
    async getEchartsData() {
      const res1 = await getGoodsAddressSale()
      this.addressWithSale = res1.data
      const res2 = await getGoodsCategoryCount()
      this.categoryWithCount = res2.data
      const res3 = await getGoodsCategoryFavor()
      this.categoryWithFavor = res3.data
      const res4 = await getGoodsCategorySale()
      this.categoryWithSale = res4.data
    }
  }
})

export default useEchartsStore